<template>
  <div class="lowNews">
    <div class="head">
      <div>
        {{ headTitle }}
      </div>
      <router-link to="/news">{{$t("home.more")}}></router-link>
    </div>
    <div class="content">
      <div
        @click="toDetail(item.id)"
        class="liItem"
        v-for="(item, index) in dataNews"
        :key="index"
      >
        <div class="left">
          <img src="../../../assets/li.png" alt="" />
        </div>
        <div class="right">
          <p class="title">
            {{ item.title }} <span v-if="item.tip" class="tip">{{$t("home.topping")}}</span>
          </p>
          <p class="context">{{ item.content }}</p>
          <p class="time">{{ item.time }}</p>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
export default {
  props: {
    dataNews: { type: [Array, Function, Object], default: () => [] },
    headTitle: { type: [String], default: "New" },
  },
  data: function () {
    return {
      activeName: "first",

      logotext: this.$t('home.latestInformation'),
    };
  },
  methods: {
    handleClick(tab) {
      this.logotext = tab.label;
      // this.getInfo(tab.lable)
    },
    toDetail(rev) {
      this.$router.push({
        path: "/newsDetail",
        query: {
          id: rev,
        },
      });
    },
    getInfo() {},
  },
};
</script>


<style lang="scss" scoped="scoped">
.lowNews {
  // background: #ccc;
  min-height: 300px;
  // padding: 20px;
  .head {
    font-size: 24px;
    font-weight: 500;
    color: #333333;
    line-height: 20px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
    a {
      font-size: 10px;
      font-weight: 400;
      color: #999999;
    }
  }
  .content {
    display: flex;
    flex-direction: column;
    .liItem {
      box-sizing: border-box;
      height: 100px;
      display: flex;
      flex-direction: row;
      padding: 10px 0;
      border-bottom: 1px solid #f1f1f1;
      .left {
        box-sizing: border-box;
        width: auto;
        min-width: 100px;
        max-width: 150px;
        margin-right: 10px;
        img {
          height: 100%;
        }
      }
      .right {
        flex: 1;
        display: flex;
        flex-direction: column;
        .title {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          font-size: 16px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #333333;
          // line-height: 14px;
          .tip {
            border-radius: 2px;
            border: 1px solid #cd001a;
            font-size: 8px;
            padding: 1px 5px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #cd001a;
          }
        }
        .context {
          font-size: 10px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #666666;
          line-height: 12px;
          flex: 1;
        }
        .time {
          font-size: 8px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #cccccc;
          line-height: 11px;
        }
      }
    }
  }
}
</style>
